import { Component, EventEmitter, Input, OnInit, Output, TemplateRef } from '@angular/core';
import { Step } from '../steps/steps.interfaces';
import { BtnAction } from './workflow.interfaces';

@Component({
  selector: 'yby-workflow',
  templateUrl: './workflow.component.html',
  styleUrls: ['./workflow.component.scss']
})
export class YbyWorkflowComponent implements OnInit {

  @Input() pageTitle: string = '';

  @Input() steps: Step[] = [];
  @Input() stepsWidth = '100%';
  get showStep() {
    return this.steps && this.steps.length > 0 ? true : false;
  }
  @Input() current = 1;
  @Input() startIndex = 1;
  @Output() stepChange: EventEmitter<number> = new EventEmitter();

  @Input() countLable?: string;
  @Input() count?: number;
  get showCount() {
    return this.count ? true : false;
  }

  @Input() centerLeftRef?: TemplateRef<void>;
  @Input() centerRightRef?: TemplateRef<void>;

  @Input() buttomAction: BtnAction[] = [];
  get hasBtns() {
    return this.buttomAction.length > 0 ? true : false;
  }

  constructor() { }

  setDisabled(action: BtnAction): boolean {
    return !action.disabled ? false : action.disabled();
  }

  ngOnInit(): void {
  }

}
